/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Slots;

import Slots.Console;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JPanel;

/**
 *
 * @author moncef
 */
public class Flash extends JPanel {

    private Console console;
    private Slots.Animation.AnimationVictoire animFlash = new Slots.Animation.AnimationVictoire();
    private Graphics2D g2d;
    public Image IMAGE_REDFLASH = Toolkit.getDefaultToolkit().createImage("Images/RedFlash.JPG");
    public Image IMAGE_REDDEAD = Toolkit.getDefaultToolkit().createImage("Images/RedDead.JPG");
    public int x = 2;

    public Flash(Console console) {
        this.console = console;
        this.setOpaque(false);
    }

    public void start() {
        animFlash.start();
    }

    public void stop() {
        animFlash.interrupt();

    }

    @Override
    public void paint(Graphics g) {

        g2d = (Graphics2D) g;
        if(x % 2 == 0){
        g.drawImage(IMAGE_REDDEAD, 80, 415, null);
        } else if(x % 2 == 1){
        g.drawImage(IMAGE_REDDEAD, 380, 415, null);
        }

        x++;

    }
}
